<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('上传签收单')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-order-add">
        <div class="form-group">
            <label class="col-sm-3 control-label">订单属性：</label>
            <div class="col-sm-8">
                <input th:value="${scmOrder.scmOrderId}" name="id"  type="hidden">
                <select class="form-control noselect2 selectpicker" name="orderType" required>
                    <option value="">--订单属性--</option>
                    <th:block th:each="option: ${OrderTypes}">
                        <option th:value="${option.code}">
                            [[${option.name}]]
                        </option>
                    </th:block>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">文件：</label>
            <div id="element" >
                <div class="col-sm-8">
                    <input type="file" id="waitReceiptFile" name="waitReceiptFile" required>
                    <a th:href="${scmOrder.waitReceiptFile}" th:if="${not #strings.isEmpty(scmOrder.waitReceiptFile)}" target="_blank">下载</a>
                </div>
            </div>
        </div>

    </form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: jquery-cxselect-js" />

<script th:inline="javascript">

    var prefix = ctx + "scm/order"
    $("#form-order-add").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            var formData = new FormData($('#form-order-add')[0]);
            $.ajax({
                url: prefix+"/uploadWaitReceipt",
                data: formData,
                cache: false,
                contentType: false,
                processData: false,
                type: 'POST',
                beforeSend: function () {
                    $.modal.loading("正在处理中，请稍候...");
                    $.modal.disable();
                },
                success: function(result) {
                    if (typeof callback == "function") {
                        callback(result);
                    }
                    $.operate.successCallback(result);
                },
                complete: function () {

                }
            });
            // $.operate.save(prefix + "/submitZhipai", $('#form-order-add').serialize());
        }
    }

</script>
</body>
</html>
